/*
   Copyright 2012 Harri Smatt

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package com.pic.girl;

import com.androidquery.AQuery;
import common.Help;
 
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;

/**
 * Simple Activity for curl testing.
 * 
 * @author harism
 */
public class BrowseActivity extends MainActivity {

	  
	AQuery aq = new AQuery(BrowseActivity.this);
	 
	String url="" ;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.web); 
		Help.addActivity(this);
		InitContent();
	}
 
	 @Override
	protected void onResume() {
		 InitContent();
		super.onResume();
	}
	 
	 @Override
	protected void onNewIntent(Intent intent) {
		 InitContent();
		super.onNewIntent(intent);
	}
	
	public void InitContent()
	{
		Intent intent = getIntent();
		url = intent.getStringExtra("url");	    
		WebSettings webSettings= aq.id(R.id.web).getWebView().getSettings();
		//aq.id(R.id.web).webImage(url, true, true, Color.WHITE);		
		webSettings.setBuiltInZoomControls(true);
		webSettings.setUseWideViewPort(true);
		webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
		aq.id(R.id.web).getWebView().loadUrl(url);
	}

  
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) { 
			 Help.GoHomeActivity(this);
			//moveTaskToBack(true); 
			return true; 
		}
		return super.onKeyDown(keyCode, event);
	}
	
 

}